<{extends file="../layout/layout.phtml"}>
<{block name='content'}>
<link rel="stylesheet" href="/css/admin_article.css">
<div id='admin-article-add'>
	<div class='type_form_div'>
		<form id="type_add_form" onsubmit='return false;'>
			<div>类名：	<input type="text" name='name' /><br></div>
			<div>上级：	<select name="fid" id="">
						<option value="0">-- 无 --</option>
						<{$type_tree}>
					</select></div>
			<div>状态
				<input name='status' value='1' type="radio" checked >是
				<input name='status' type="radio" value='0' >否
			</div>
			<div><button id='type_add'>保存</button></div>
		</form>
	</div>
</div>
<script>
	window.addEvent('domready',function(){
	    var product_request = new Request.JSON({
	        url: '/index.php/admin/article/ajax_addtypechk',
	        method: 'post',
	        onRequest: function(){
	            
	        },
	        onSuccess: function(responseJson){
	            alert(responseJson.msg);
	            if(responseJson.flag){
	                window.reload();
	            }
	        },
	        onFailure: function(){
	            alert('Sorry, your request failed :(');
	        }
	    }); 
	    // and to send it:
	    $("type_add").addEvent('click',function(){
	        
	        product_request.send($("type_add_form").toQueryString());
	    })
	})
</script>
<{/block}>